﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
 	<!-- 包含公共的JSP代码片段 -->
	
<title>无线点餐平台</title>



<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="style/js/jquery.js"></script>
<script type="text/javascript" src="style/js/page_common.js"></script>
<link href="style/css/common_style_blue.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="style/css/index_1.css" />
<link href="${pageContext.request.contextPath}/sys/style/css/toastr.css" rel="stylesheet" />
<script type="text/javascript" src="${pageContext.request.contextPath}/sys/style/js/toastr.min.js"></script>
<script src="${pageContext.request.contextPath}/Customer/laydate/laydate.js"></script>
    <script type="text/javascript">
	function openWin(){
		window.open('common_page_list.html');
		this.close();
	}
	function addConfirm(){
	return window.confirm("您确定要增加一条记录吗？");	
}
	
	
	</script>
</head>
<body>


<!-- 页面标题 -->
<div id="TitleArea">
	<div id="TitleArea_Head"></div>
	<div id="TitleArea_Title">
		<div id="TitleArea_Title_Content">
			<img border="0" width="13" height="13" src="style/images/title_arrow.gif"/>  添加新桌
		</div>
    </div>
	<div id="TitleArea_End"></div>
</div>


<!-- 主内容区域（数据列表或表单显示） -->
<div id="MainArea">
	<!-- 表单内容 -->
	<!-- 把填好的数据传给struts里的action的name为add里的action进行处理 -->
	<form action="${pageContext.request.contextPath}/add.action" method="post" onSubmit="return myCheck()">
		<!-- 本段标题（分段标题） -->
		<div class="ItemBlock_Title">
        	<img width="4" height="7" border="0" src="style/images/item_point.gif"> 新桌信息&nbsp;
        </div>
		<!-- 本段表单字段 -->
        <div class="ItemBlockBorder">
            <div class="ItemBlock">
				<div class="ItemBlock2">
					<table cellpadding="0" cellspacing="0" class="mainForm">
						
						 <!-- <tr>
							<td width="80px">新桌ID号</td>
							<td><input id="id" type="text" name="bid" class="InputStyle"/>*</td>
						</tr>  -->
						
						<tr>
							<td width="80px">新桌名字</td>
							<td><input id="mingzi" type="text" name="bname" class="InputStyle"/>*</td>
						</tr>
						
						<tr>
							<td width="80px">新桌状态</td>
							<td><input id="zt" type="text" name="bstatus" class="InputStyle"/>*</td>
						</tr>
						<tr>
							<td width="80px">桌子上架日期</td> 
							<td><input id="time" placeholder="请输入桌子上架日期" class="laydate-icon" onclick="laydate()" type="text" name="btime" class="InputStyle"/>*</td>
						</tr>
						<tr>
							<td width="80px">新桌类型</td>
							<td><input id="leixing" type="text" name="btype" class="InputStyle"/>*</td>
						</tr>
					</table>
				</div>
            </div>
        </div>
		
		<!-- 表单操作 -->
		<div id="InputDetailBar">
            <input type="submit" value="添加" onClick="return addConfirm();" class="FunctionButtonInput"/>
            
        <a href="javascript:history.go(-1);" class="FunctionButton">返回</a>
        </div>
        
	</form>
	
</div>

<script type="text/javascript">

       laydate({
             elem: '#demo'
              })
              
  	  toastr.options.positionClass = 'toast-bottom-right'; //初始化 toastr 提示插件
			 /* toastr.success('提交数据成功');
				toastr.error('Error');
				toastr.warning('只能选择一行进行编辑');
				toastr.info('info'); */
             toastr.options = {  
							        closeButton: false,  
							        debug: false,  
							        progressBar: true,  
							        positionClass: "toast-top-full-width",  
							        onclick: null,  
							        showDuration: "100",  
							        hideDuration: "500",  
							        extendedTimeOut: "1000",  
							        showEasing: "swing",  
							        hideEasing: "linear",  
							        showMethod: "fadeIn",  
							        hideMethod: "fadeOut", 
							        timeOut: "1000" 
							    };    
               
                             
    		function myCheck()
			{		
			    
			    
				
				if(document.getElementById("mingzi").value=="")
				{	
					toastr.error("新桌名字不能为空!");					
					return false;
				}
				else
				{
					var zm = document.getElementById("mingzi").value;
					if(zm=="东桌"||zm=="南桌"||zm=="西桌"||zm=="北桌")
					{}	
					else
					{
						toastr.error("新桌名字必须为东桌、西桌、南卓或者北桌!");
						return false;
					}
				}
								
				if(document.getElementById("zt").value=="")
				{
				    toastr.error("新桌状态不能为空!");
					return false;
				}
				else
				{
					var zt = document.getElementById("zt").value;
					console.log(zt);
					if(zt=="1"||zt=="0")
					{}	
					else
					{
						toastr.error("新桌状态必须为0或者1!");
						return false;
					}
				}	
							
				if(document.getElementById("time").value=="")
				{
				    toastr.error("新桌上架时间不能为空!");
					return false;
				}
				
				if(document.getElementById("leixing").value=="")
				{	
					toastr.error("新桌类型不能为空!");
					return false;
				}
				else
				{
					var leixing = document.getElementById("leixing").value;
					if(leixing=="小桌"||leixing=="大桌"||leixing=="vip桌")
					{}	
					else
					{
						toastr.error("新桌类型必须为小桌、大桌或者vip桌!");
						return false;
					}
				}

				return true;
			}             
  




</script>

</body>
</html>
